﻿using System.Runtime.InteropServices;

namespace Ast.Core.Pe.Definitions
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct DataDirectoryEntry
    {
        public uint VirtualAddress;

        public uint Size;

        public override string ToString()
        {
            return string.Format("VirtualAddress={0:X8}, Size={1:X8}", VirtualAddress, Size);
        }

        public bool Contains(long virtualAddress)
        {
            return ((virtualAddress >= VirtualAddress) && (virtualAddress < VirtualAddress + Size));
        }
    }
}